package com.rc.saas.tenant.service.invite;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.rc.saas.tenant.mapper.invite.MemberInviteLinkMapper;
import com.rc.saas.tenant.search.invite.InviteSearch;
import com.rc.saas.tenant.vo.invite.InviteLinkListVo;
import com.rc.saas.tenant.vo.invite.InviteMemberDetailVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Create by Yang on 2021/4/23
 */
@Service
public class MemberInviteLinkServiceImpl implements MemberInviteLinkService {

    @Autowired
    private MemberInviteLinkMapper memberInviteLinkMapper;

    @Override
    public MemberInviteLinkMapper getMapper() {
        return memberInviteLinkMapper;
    }

    @Override
    public PageInfo<InviteLinkListVo> listInviteLink(InviteSearch inviteSearch) {
        PageHelper.startPage(inviteSearch.getOffset(), inviteSearch.getLimit());
        List<InviteLinkListVo> inviteLinkListVos = memberInviteLinkMapper.listInviteLink(inviteSearch);
        return new PageInfo<>(inviteLinkListVos);
    }

    @Override
    public PageInfo<InviteMemberDetailVo> listInviteLinkDetail(InviteSearch inviteSearch) {
        PageHelper.startPage(inviteSearch.getOffset(), inviteSearch.getLimit());
        List<InviteMemberDetailVo> inviteSettingVos = memberInviteLinkMapper.listInviteLinkDetail(inviteSearch);
        return new PageInfo<>(inviteSettingVos);
    }
}
